
const mobileModel = require('../models/mobile')

const list = async (req, res, next) => {
  res.set('content-type', 'application/json;charset=utf-8')
  let { start, pageSize } = req.query
  let result = await mobileModel.list(~~start, ~~pageSize)
  if(result) {
    res.render('succ', {
      data: JSON.stringify({
        result,
        message: '成功！'
      })
    })
  } else {
    res.render('fail', {
      data: JSON.stringify({
        message: '失败。'
      })
    })
  }
}

exports.list = list